
#include <stdio.h>
#include "math.h"
int main()
{

    int a1, a2, a3;
    int b1, b2, b3;
    char *out;
    // printf("n\n");
    scanf("%d %d %d %d %d %d", &a1, &a2, &a3, &b1, &b2, &b3);
    b1 += a1;
    b2 += a2;
    b3 += a3;

    b2 += b3 / 60;
    b3 = b3 % 60;

    b1 += b2 / 60;
    b2 = b2 % 60;

    printf("%d %d %d", b1, b2, b3);

    return 0;
}